package com.exam.view;

import com.exam.Dao.Impl.QuestionControlDaoImpl;
import com.exam.control.ExamAndRoom;
import com.exam.control.SelectBank;

import java.sql.SQLException;
import java.util.Scanner;

/**
 * @ClassName Menu
 * @Description TODO
 * @Author 86183
 * @Date 2022/4/7 23:16
 * @Version 1.0
 **/
public class Menu {
    private static final String SELECT_BANK="查询试题库";
    private static final String SELECT_TEST_EXAM="查询试卷与考试信息";
    private static final String ADD_INTO_BANK="添加题目到试题库";
    private static final String UPDATE_BANK="修改试题库中的题目";
    private static final String DELETE_BANK="删除试题库中的题目";
    Scanner sc=new Scanner(System.in);
    QuestionControlDaoImpl questionControl=new QuestionControlDaoImpl();
    public boolean menu(Object object) throws SQLException {
        if(SELECT_BANK.equals(object)){
            SelectBank bankSelect=new SelectBank();
            bankSelect.select();
        }

        if(SELECT_TEST_EXAM.equals(object)){
            System.out.println("请输入考场号获取该考场试卷:");
            int number=sc.nextInt();
            ExamAndRoom search=new ExamAndRoom();
            search.exam(number);
        }

        if(ADD_INTO_BANK.equals(object)){
            questionControl.insert();
        }

        if(UPDATE_BANK.equals(object)){
            questionControl.update();
        }
        if(DELETE_BANK.equals(object)){
            questionControl.delete();
        }
        return true;
    }
}
